CREATE TABLE jms_dm.dm_aviation_order_detail_dt (
     waybill_no                    varchar(255)     COMMENT  '运单号'
    ,booking_space_no              varchar(255)     COMMENT  '订舱号'
    ,operation_time                DateTime         COMMENT  '发货上报时间'
    ,pick_network_code             varchar(255)     COMMENT  '订单所属网点编码'
    ,operation_date                Date             COMMENT  '发货上报日期'
    ,collect_time                  DateTime         COMMENT  '揽收时间'
    ,package_code                  varchar(255)     COMMENT  '包号'
    ,send_scan_time                DateTime         COMMENT  '航空发件时间'
    ,arrive_scan_time              DateTime         COMMENT  '航空到件时间'
    ,pick_network_name             varchar(255)     COMMENT  '订单所属网点名称'
    ,pick_agent_area_name          varchar(255)     COMMENT  '订单所属代理区'
    ,origin_center_code            varchar(255)     COMMENT  '航空始发机构编号'
    ,origin_center_name            varchar(255)     COMMENT  '航空始发机构名称'
    ,origin_agent_area_id          varchar(255)     COMMENT  '航空始发代理区ID'
    ,origin_agent_area_code        varchar(255)     COMMENT  '航空始发代理区编号'
    ,origin_agent_area_name        varchar(255)     COMMENT  '航空始发代理区'
    ,origin_airport                varchar(255)     COMMENT  '始发机场'
    ,destination_agent_area_id     varchar(255)     COMMENT  '航空目的地代理区ID'
    ,destination_agent_area_code   varchar(255)     COMMENT  '航空目的地代理区code'
    ,destination_agent_area_name   varchar(255)     COMMENT  '航空目的地代理区'
    ,destination_center_code       varchar(255)     COMMENT  '航空目的地机构编号'
    ,destination_center_name       varchar(255)     COMMENT  '航空目的地机构名称'
    ,destination_airport           varchar(255)     COMMENT  '目的机场'
    ,package_inside_charge_weight  Decimal(10,2)    COMMENT  '内部计费重量'
    ,dispatch_time                 DateTime         COMMENT  '派件时间'
    ,dispatch_agent_code           varchar(255)     COMMENT  '派件代理区编码'
    ,dispatch_agent_name           varchar(255)     COMMENT  '派件代理区名称'
    ,dispatch_network_code         varchar(255)     COMMENT  '派件网点编码'
    ,dispatch_network_name         varchar(255)     COMMENT  '派件网点名称'
    ,sender_province_id            varchar(255)     COMMENT  '寄件省ID'
    ,sender_province_name          varchar(255)     COMMENT  '寄件省'
    ,sender_city_id                varchar(255)     COMMENT  '寄件市ID'
    ,sender_city_name              varchar(255)     COMMENT  '寄件市'
    ,sender_area_id                varchar(255)     COMMENT  '寄件区ID'
    ,sender_area_name              varchar(255)     COMMENT  '寄件区'
    ,receiver_province_id          varchar(255)     COMMENT  '目的省ID'
    ,receiver_province_name        varchar(255)     COMMENT  '目的省'
    ,receiver_city_id              varchar(255)     COMMENT  '目的市ID'
    ,receiver_city_name            varchar(255)     COMMENT  '目的市'
    ,receiver_area_id              varchar(255)     COMMENT  '目的区ID'
    ,receiver_area_name            varchar(255)     COMMENT  '目的区'
    ,plan_cainiao_platform_date    DateTime         COMMENT  '菜鸟规划应签收日期'
    ,cainiao_platform_effect       BigInt           COMMENT  '菜鸟平台时效'
    ,is_pres_sign                  BigInt           COMMENT  '时效签收'
)
ENGINE=olap
DUPLICATE KEY(waybill_no, booking_space_no, operation_time,  pick_network_code)
COMMENT '航空订单明细'
PARTITION BY RANGE (operation_date) (
    START ("2023-12-20") END ("2024-01-20") EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(waybill_no) BUCKETS 1
PROPERTIES (
    "replication_num" = "3",
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.start" = "-185",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.buckets" = "1",
    "in_memory" = "false",
    "storage_format" = "V2"
);